package crp.core.workflow.domain.services;

import crp.core.workflow.domain.models.WorkflowTaskEntity;
import crp.core.workflow.domain.models.WorkflowTaskStatus;
import crp.core.workflow.domain.repositories.WorkflowTaskRepository;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import java.util.Collection;
import java.util.stream.Stream;

@ApplicationScoped
public class WorkflowTaskSearcher {
    private final WorkflowTaskRepository taskRepository;

    @Inject
    public WorkflowTaskSearcher(WorkflowTaskRepository taskRepository) {
        this.taskRepository = taskRepository;
    }

    public Stream<WorkflowTaskEntity> byInstanceIds(Collection<String> instanceIds,
                                                    WorkflowTaskStatus status) {
        return taskRepository.byInstanceIds(instanceIds, status);
    }

    public Stream<WorkflowTaskEntity> byIds(Collection<String> ids) {
        return taskRepository.byIds(ids);
    }
}
